<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in Lbsrc" :key="item.id">
        <img
          :src="'http://liufusong.top:8080' + item.imgSrc"
          alt=""
          class="lbsrc"
        />
      </van-swipe-item>
    </van-swipe>
    <div class="ar-search">
      <van-search v-model="value" show-action placeholder="请输出小区或地址">
        <template #label>
          <div @click="tzcity">{{ mycity }}▼ 丨</div></template
        >
        <template #action>
          <van-icon name="location-o" class="map" />
        </template>
      </van-search>
    </div>
    <div class="tange">
      <van-grid>
        <van-grid-item icon="wap-home-o" text="整租" />
        <van-grid-item icon="friends-o" text="合租" />
        <van-grid-item icon="map-marked" text="地图找房" />
        <van-grid-item icon="wap-home" text="去出租" />
      </van-grid>
    </div>
    <div>
      <div class="group">
        <h3>租房小组</h3>
        <span>更多</span>
      </div>
      <van-grid :column-num="2" direction="horizontal" :border="false">
        <van-grid-item v-for="item in ZFxz" :key="item.id" :icon-size="3">
          <van-image :src="'http://liufusong.top:8080' + item.imgSrc" />
          <van-card :desc="item.desc" :title="item.title" />
        </van-grid-item>
      </van-grid>
    </div>
  </div>
</template>

<script>
import { Lbsrc, ZFxz } from '@/api/ariticle'
import { getCity, setCity } from '@/utils/storage'
export default {
  name: 'my-arite',

  async created() {
    const {
      data: { body }
    } = await Lbsrc()
    this.Lbsrc = body
    const {
      data: { body: res }
    } = await ZFxz()
    console.log(res)
    this.ZFxz = res
  },
  data() {
    return {
      value: '',
      Lbsrc: [],
      ZFxz: [],
      mycity: getCity() || '上海'
    }
  },
  methods: {
    tzcity() {
      this.$router.push('/city')
      setCity(this.mycity)
    }
  }
}
</script>

<style scoped lang="less">
.goods-card {
  margin: 0;
}
.delete-button {
  height: 100%;
}
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.ar-search {
  position: absolute;
  top: 10px;
  left: 5%;
  width: 90%;
  left: center;
}
.van-search {
  background-color: transparent;
}
.map {
  width: 25px;
  font-size: 26px;
  margin-top: 8px;
}
.lbsrc {
  width: 100%;
  height: 100%;
}
/deep/.tange .van-icon {
  background-color: #f2fbf7;
  color: #06b069;
}
/deep/.tange .van-grid-item__icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  line-height: 70px;
  text-align: center;
  font-size: 36px;
}
.group {
  display: flex;
  justify-content: space-between;
  padding: 10px;
}
</style>
